﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <link href="../Content/bootstrap.css" rel="stylesheet" />
</head>
<body>
    <h1 class="text-center">选手增加</h1>
    <div class="container text-center">
        <div class="row">
            <div class="col-md-12">
                <span>选手编号：</span><input type="text" id="playerNO" />
            </div>
        </div><br />
        <div class="row">
            <div class="col-md-12">
                <span>选手姓名：</span><input type="text" id="playerName" />
            </div>
        </div>
        <!--<div class="row">
            <div class="col-md-12">
                <span>选手图片：<input type="file" class="text-center" /></span>
            </div>
        </div>-->
        <div class="row">
            <div class="col-md-12">
                <input type="button" id="playerAdd" value="添加" />
            </div>
        </div>
    </div>

    <script src="../Scripts/jquery-1.10.2.js"></script>
    <script src="../Scripts/bootstrap.js"></script>
    <script type="text/javascript">
        $(function () {

        });
        $("#playerAdd").click(function () {
            var PlayerName = $("#playerName").val();
            var PlayerNO = $("#playerNO").val();
            if (PlayerName == "" || PlayerNO == "") {
                alert("请填写完整信息");
                return false;
            }
            var data = { PlayerName: PlayerName, PlayerNO: PlayerNO };
            $.ajax({
                url: "/Players/Create",
                data: data,
                type: "POST",
                async: true,
                dataType: "JSON",
                success: function (date) {
                    alert(date+date == 1 ? "添加成功" : "添加失败");
                },
                error: function () { }
                
            });
        });
    </script>
</body>
</html>